package com.example.medmobile;

import WebService.SoapWebService;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import com.google.appengine.medmobileserver.business.PlanoSaude;

public class CadastroHandler extends Cadastro {

	@Override
	protected void CarregaListaPlanoSaude(final Context context) {
		new Thread() {
			public void run() {
				if (Global.getListaPlanoSaude() != null)
					listaPlanoSaude = Global.getListaPlanoSaude();
				else {
					listaPlanoSaude = SoapWebService.getPlanosSaudeAll();
					Global.setListaPlanoSaude(listaPlanoSaude);
				}

				runOnUiThread(new Runnable() {
					public void run() {
						Spinner spPlanoSaude = (Spinner) findViewById(R.id.CadastroPacientePlanoSaude);
						ArrayAdapter<PlanoSaude> ar = new ArrayAdapter<PlanoSaude>(
								context, android.R.layout.simple_spinner_item,
								listaPlanoSaude);
						ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
						spPlanoSaude.setAdapter(ar);
					}
				});

			}
		}.start();

	}


}
